﻿
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_WindowSmall.cshtml";
}
@model OneStationFile.Model.Node
<div id="page-wrapper1">
    <div class="container-fluid">
        <!-- Page Heading -->
        <div class="row">
            <div class="col-lg-12">
                <h3 class="page-header">
                    @ViewBag.action 节点 
                </h3>

            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <form role="form" action="#" id="Systemform">
                    @Html.HiddenFor(p=>p.Id)
                    <div class="form-group">
                        <label>@Html.LabelFor(p=>p.Name)</label>
                        @Html.TextBoxFor(p => p.Name, new { @class = "form-control" })
                    </div>
                    <div class="form-group">
                        <label>@Html.LabelFor(p => p.Url)</label>
                        @Html.TextBoxFor(p => p.Url, new { @class = "form-control" })
                    </div>
                    <div class="form-group">
                        <label>@Html.LabelFor(p => p.Controller)</label>
                        @Html.TextBoxFor(p => p.Controller, new { @class = "form-control"})
                    </div>
                    <div class="form-group">
                        <label>@Html.LabelFor(p => p.Action)</label>
                        @Html.TextBoxFor(p => p.Action, new { @class = "form-control" })
                    </div>
                    <div class="form-group">
                        <label>@Html.LabelFor(p => p.IsShow)</label>
                        @Html.DropDownListFor(p => p.IsShow, new SelectList(OneStationFile.Common.EnumHelper.GetListOfEnum<OneStationFile.Common.ListOfEnum.IsShow>(), "value", "key"), new { @class = "form-control" })
                    </div>
                    <div class="form-group">
                        <label>@Html.LabelFor(p => p.NodeLevelD)</label>
                        @Html.DropDownListFor(p => p.NodeLevelD, new SelectList(OneStationFile.Common.EnumHelper.GetListOfEnum<OneStationFile.Common.ListOfEnum.NodeLevelD>(), "value", "key"), new { @class = "form-control" })
                    </div>
                    <div class="form-group" id="ParentId">
                        <label>@Html.LabelFor(p => p.ParentId)</label>
                        @Html.DropDownListFor(p => p.ParentId, ViewData["leveld"] as SelectList, new { @class = "form-control" })
                    </div>
                    
                    <button type="button" onclick="Add();" class="btn btn-default">提交</button>
                    <button type="button" onclick="art.dialog.close();" class="btn btn-default">取消</button>
                </form>
            </div>

        </div>
        <!-- /.row -->
    </div>
    <!-- /.container-fluid -->
</div>
@section scripts{
    <script>
        $(document).ready(function () {
            $("#ParentId").hide();
            if ($("#NodeLevelD").val() == 2) {
                $("#ParentId").show();
            }
        });
        $("#NodeLevelD").change(function () {
            var val = $(this).val();
            if (val == 2) {
                $("#ParentId").show();
            } else {
                $("#ParentId").hide();
            }
        });
        function Add() {
            var Systemform = $('#Systemform');
            Systemform.ajaxSubmit({
                url: "/Node/EditHandle",
                type: "post",
                dataType: "json",
                clearForm: false, //提交成功后是否清空表单中的字段值
                restForm: false, //提交成功后是否重置表单中的字段值，即恢复到页面加载时的状态
                timeout: 6000, //设置请求时间，超过该时间后，自动退出请求，单位(毫秒)。　　
                success: function (Resault) {
                    art.dialog.tips(Resault.msg);
                    if (Resault.res == true) {
                        var win = art.dialog.open.origin;//来源页面
                        // 如果父页面重载或者关闭其子对话框全部会关闭
                        setTimeout(function () { win.location.reload();; }, 1000);
                    }
                }
            });
        }
    </script>
    }

